package com.tuantuan.common.exception;

import com.tuantuan.common.base.common.IServerErrorCode;

/**
 * 业务异常
 *
 * @author wangqinmin
 * @date 2018/08/05
 */
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = -3008701086164361883L;

    private String code;

    private String description;


    public BusinessException(String code, String description, Throwable cause) {
        super(description, cause);
        this.code = code;
        this.description = description;
    }

    public BusinessException(String code, String description) {
        super(description);
        this.code = code;
        this.description = description;
    }

    public BusinessException(IServerErrorCode handler, String description) {
        super(description);
        this.code = handler.getCode();
        this.description = description;
    }

    public BusinessException(IServerErrorCode handler, Throwable cause) {
        super(handler.getMsg(), cause);
        this.code = handler.getCode();
        this.description = handler.getMsg();
    }

    public BusinessException(IServerErrorCode handler) {
        super(handler.getMsg());
        this.code = handler.getCode();
        this.description = handler.getMsg();
    }

    public BusinessException() {
        super();
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
